package com.qn.visitor.write.mysql;

import com.qn.visitor.entity.IpAddressRecord;
import com.qn.visitor.mapper.IpAddressRecordMapper;
import com.qn.visitor.write.IpAddressrWrite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * qingniu-cloud user source analysis
 *
 * @Author: TXG
 * @Date: 2024/6/11
 * @Version V0.0.2
 */
@Service("MySqlIpAddressrWrite")
public class IpAddressrWriteImpl
        implements IpAddressrWrite {
    private static Logger log= LoggerFactory.getLogger(IpAddressrWriteImpl.class);
    @Autowired
    IpAddressRecordMapper baseMapper;
    @Override
    public void add(IpAddressRecord record) {
        try {
            baseMapper.insert(record);
        } catch (Exception e) {
            log.warn("数据写入异常",record);
        }
    }

    @Override
    public String getHash(String hash, Integer ipSource) {
        return baseMapper.getHash(hash, ipSource);
    }
}
